<template>
  <div>
    <a-modal
      :width="800"
      :footer="null"
      v-model="visible"
      title="搜索其他资源"
      @cancel="onCancel"
    >
      <a-input-search placeholder="input search text" enter-button @search="onSearch" />
      <a-table
        bordered
        size="small"
        :columns="columns"
        :data-source="dataSource"
        :pagination="false"
      >
        <template slot="action">
          <a-button size="small" type="primary" @click="addWechat">添加微信</a-button>
        </template>
      </a-table>
    </a-modal>
    <a-modal
      title="添加微信信息"
      v-model="wechatVisible"
    >
      <a-form-model
        ref="wechatForm"
        :model="wechatForm"
        :rules="wechatRules"
        :label-col="labelCol"
        :wrapper-col="wrapperCol"
      >
        <a-form-model-item label="客户电话">
          <a-row :gutter="20">
            <a-col :span="16">
              <a-input readOnly type="text" value="13233297926、13233297926、15303566837" />
            </a-col>
            <a-col :span="6">
              <a-button type="primary">微信是否同号</a-button>
            </a-col>
          </a-row>
        </a-form-model-item>
        <a-form-model-item label="微信号码" prop="wechat">
          <a-input type="text" v-model="wechatForm.wechat" placeholder="请输入微信号" />
        </a-form-model-item>
      </a-form-model>
    </a-modal>
  </div>
</template>

<script>
export default {
  name: 'OtherSearch',
  data () {
    return {
      visible: false,
      columns: [
        {
          title: '资源类型',
          dataIndex: 'customer_type'
        },
        {
          title: '业务名称',
          dataIndex: 'business_name'
        },
        {
          title: '联系电话',
          dataIndex: 'phone'
        },
        {
          title: '操作',
          dataIndex: 'action',
          scopedSlots: { customRender: 'action' }
        }
      ],
      dataSource: [
        {
          customer_type: '会计同行',
          business_name: '天猫',
          phone: '13233297926、13233297926、15303566837'
        },
        {
          customer_type: '驳回复审',
          business_name: '马婷婷',
          phone: '13233297926、13233297926'
        }
      ],
      wechatVisible: false,
      labelCol: { span: 4 },
      wrapperCol: { span: 20 },
      wechatForm: {},
      wechatRules: {
        wechat: [{ required: true, message: '必须输入已添加的微信号', trigger: 'blur' }]
      }
    }
  },
  created () {
    this.visible = true
  },
  methods: {
    onCancel () {
      this.visible = false
      this.$emit('cancel', this.visible)
    },
    addWechat () {
      this.wechatVisible = true
    },
    onSearch () {}
  }
}
</script>

<style scoped>

</style>
